//首次定位
$$.ajax({
	    url:"http://192.168.5.22:8080/webmeeting/user/location",
	    method:"GET",
		data:{},
		dataType:'json',
		timeout:4000,
		success: function (ajaxresult) {
			var cX = ajaxresult[0].mapCoordinate.x;
			var cY = ajaxresult[0].mapCoordinate.y;
			currentblock[0] = Math.abs(Math.round(cX/mapRatioW/netrectW)-1);
			currentblock[1] = Math.abs(Math.round(cY/mapRatioH/netrectH)-1);
			//console.log(cX,cY,scale,currentblock);
			setCurrentPos();
			//myApp.alert('请求成功<br>mapCoordinate.x='+cX+'<br>mapCoordinate.y='+cY);
		},
		error:function(){
			myApp.alert('请求失败');
		}
});
//每隔五秒刷新定位
var getLoctimer =  setInterval(function(){
		//获取ip
	    $$.ajax({
	    	url:"http://192.168.5.22:8080/webmeeting/user/location",
		    method:"GET",
			data:{},
			dataType:'json',
			timeout:4000,
			success: function (ajaxresult) {
				var cX = ajaxresult[0].mapCoordinate.x;
				var cY = ajaxresult[0].mapCoordinate.y;
				currentblock[0] = Math.abs(Math.round(cX/mapRatioW/netrectW)-1);
				currentblock[1] = Math.abs(Math.round(cY/mapRatioH/netrectH)-1);
				//console.log(cX,cY,scale,currentblock);
				setCurrentPos();
				//myApp.alert('请求成功<br>mapCoordinate.x='+cX+'<br>mapCoordinate.y='+cY);
			},
			error:function(){
				myApp.alert('请求失败');
				clearInterval(getLoctimer);
			}
		});
},getLoctime);


